package org.example.service;


import org.example.mapper.ArticleMapper;
import org.example.mapper.UserMapper;
import org.example.model.Article;
import org.example.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ArticleService {


    @Autowired
    private ArticleMapper articleMapper;

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private UserService userService;

    public List<Article> selectArticlesAndUsers() {
        return articleMapper.selectArticlesAndUsers();
    }


    @Transactional(propagation = Propagation.NESTED)
    public int update(){
        Article a = new Article();
        a.setId(1);
        a.setContent("test,修改的内容");
        return articleMapper.update(a);
    }


}
